<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .up{
            width: 100%;
            text-align: center;
        }
        .up img{
            width: 120px;
        }
        .down{
            width: 100%;
            text-align: center;
        }
        .down img{
            width: 300px;
        }
    </style>
</head>
<body>
<div class="up">
    <img src="images/1.jpg" alt="">
    <img src="images/2.jpg" alt="">
    <img src="images/3.jpg" alt="">
</div>
<div class="down">
    <img src="images/1.jpg" alt="">
</div>

    <script>
        var oImgs=document.querySelectorAll(".up img");
        var oImg=document.querySelector(".down img");
        
        for(var i=0;i<oImgs.length;i++){
            oImgs[i].tempIndex=i;
            oImgs[i].onclick=function(){
                oImg.setAttribute("src",`images/${this.tempIndex+1}.jpg`)
            }
        }
    </script>
</body>
</html>